<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="v2/layout">
  <head>
    <title>欢迎进入管理系统</title>
    <script type="text/javascript" th:inline="javascript">
    	var orgName = [[${session.user.name}]];
    	var state = getParam("state", "");
    	
    	$(function(){
    		setMenu("比赛列表", true);
    		
    		$("#state li[data-state='"+state+"']").addClass("active")
    		$("#state li").click(function(){
    			location.href=setParam({state:$(this).data("state")})
    		});
    		
    		$.ajaxData({url:"list-count",data:{state:state},success:function(data){
    			data.applyCount = (data.applyCount==null?0:data.applyCount)
    			data.dayApplyCount = (data.dayApplyCount==null?0:data.dayApplyCount)
    			data.blogCount = (data.blogCount==null?0:data.blogCount)
    			data.dayBlogCount = (data.dayBlogCount==null?0:data.dayBlogCount)
    			data.moneyCount = (data.moneyCount==null?0:data.moneyCount)
    			data.dayMoneyCount = (data.dayMoneyCount==null?0:data.dayMoneyCount)
    			data.lookCount = (data.lookCount==null?0:data.lookCount)
    			data.dayLookCount = (data.dayLookCount==null?0:data.dayLookCount)
    			data.openCount = (data.openCount==null?0:data.openCount)
    			data.dayOpenCount = (data.dayOpenCount==null?0:data.dayOpenCount)
    			data.hdCount = (data.hdCount==null?0:data.hdCount)
    			data.dayHDCount = (data.dayHDCount==null?0:data.dayHDCount)
    			$("#indexCount").loadData(data);
    		}})
    		
    		$("#listPage").page({url:"list-list",data:{state:state}, success:function(ret){
      			$.each(ret.obj.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        		});
      			$("#list").loadData({content:ret.obj.content,orgName:orgName});
      		}});
    	});
    </script>
    <style>
    </style>
  </head>
  <body>
    <div layout:fragment="content">
    	<div class="c_tab">
   			<ul class="c_tab-list" id="state">
   				<li data-state="">全部</li>
   				<li data-state="Release">已发布</li>
   				<li data-state="NotRelease">未发布</li>
   			</ul>
    	</div>
    	<div class="info info-full">
    		<div class="stat">
	            <div class="stat-top">
	                <span class="stat-title"><strong>关键数据</strong></span>
	            </div>
	            <div class="stat-content">
	            	<script type="text/template" id="indexCount">
	            	<div class="stat-row">
		                <div class="stat-group">
		                    <div class="stat-group-title">报名人数</div>
		                    <div class="stat-group-count"><strong>#{applyCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayApplyCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group">
		                    <div class="stat-group-title">作品帖数</div>
		                    <div class="stat-group-count"><strong>#{blogCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayBlogCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group">
		                    <div class="stat-group-title">收费总数</div>
		                    <div class="stat-group-count"><strong>#{moneyCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayMoneyCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group">
		                    <div class="stat-group-title">浏览总数</div>
		                    <div class="stat-group-count"><strong>#{lookCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayLookCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group">
		                    <div class="stat-group-title">打开总数</div>
		                    <div class="stat-group-count"><strong>#{openCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayOpenCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group">
		                    <div class="stat-group-title">互动总数</div>
		                    <div class="stat-group-count"><strong>#{hdCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayHDCount}#</span>
		                    </div>
		                </div>
	                </div>
	                </script>
	            </div>
	
	        </div>
    	</div>
    	
		<div class="info info-full">
			<div class="table_list">
               <div class="table-overflow">
                   <table class="table">
                       <thead>
                           <tr>
                               <th width="100px">比赛概况</th>
                               <th>比赛创建时间</th>
                               <th>比赛系统时间</th>
                               <th>发布状态</th>
                               <th>报名人数</th>
                               <th>收费</th>
                               <th>操作</th>
                           </tr>
                       </thead>
                       <tbody>
                       <script type="template" id="list">
						#for(data:content)#
						<tr>
                       	<td>
                       		<div class="a_eval">
                       			<div class="a_eval-left"><img class="a_eval-img" src="#{data.coverUrl}#"/></div>
                       			<div class="a_eval-right">
                       				<div class="a_eval-title"><strong>#{data.title}#</strong></div>
                       				<div class="a_eval-desc">
                       					<span class="a_eval-label">地点：</span>
                       					<span class="a_eval-text">#{data.area}#</span>
                       				</div>
                       				<div class="a_eval-desc">
                       					<span class="a_eval-label">时间：</span>
                       					<span class="a_eval-text">#{data.timeInList}#</span>
                       				</div>
                       				<div class="a_eval-desc">
                       					<span class="a_eval-label">主办方：</span>
                       					<span class="a_eval-text">#{orgName}#</span>
                       				</div>
                       				<div class="a_eval-desc">
                       					<span class="a_eval-label">报名费：</span>
                       					<span class="a_eval-text">#{data.charge}#</span>
                       				</div>
                       			</div>
                       		</div>
                       	</td>
						<td>#{data.createdAt}#</td>
						<td>#{data.timeInList}#</td>
						<td>#{data.stateDesc}#</td>
						<td>#{data.applyCount}#</td>
						<td>
							#if(data.moneySum=='')# 0 #endif#
							#if(data.moneySum!='')# #{data.moneySum}# #endif#
							
						</td>
						<td>
							<div class="tab-btn-list">
								<a class="tab-btn-item" href="list-detail?id=#{data.id}#">进入比赛</a>
							</div>
						</td>
                       </tr>
						#endfor#
						</script>
                     </tbody>
                 </table>
                 <div id="listPage"></div>
             </div>
          </div>
    	</div>
    	
    </div>
  </body>
</html>